#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os.path
# here put the import lib
from distutils.core import setup
from distutils.extension import Extension

from Cython.Build import cythonize

files_address = 'UTIL'
selected_string = '.py'


def find_py(path='.'):
    py_files = []
    for root, dirs, files in os.walk(path):
        for file in files:
            if file.endswith(selected_string):
                full_path = os.path.join(root, file)
                py_files.append(full_path)
    return py_files


# ext_modules = [
#     "config.py",
#     "main.py",
#     "multi_team.py",
#     "multi_team_parallel.py",
#     "task_runner.py"
# ]

ext_modules = find_py(files_address)

print(ext_modules)

extensions = [
    Extension(
        os.path.splitext(os.path.relpath(f, files_address))[0].replace(os.path.sep, "."),
        [f]
    ) for f in ext_modules
]

ext_modules = [
    "CssimAgentEnvBase.py"
]

setup(ext_modules=cythonize(ext_modules))

# 代码在命令行执行：python setup.py build_ext --inplace
# 生成.c和.pyd文件，其中.pyd文件要去除前面的python版本后缀才能使用
#
